From: Colin Walters Date: Wed, 8 Jul 2009 15:54:15 +0000 (-0400) Subject: Don't fail if we can't find an application X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~11214 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3b603ef7e0299e7c41420c3de97bbadfa60eb629;p=gnome-shell.git Don't fail if we can't find an application Instead of logging and passing null through, explicitly skip apps we don't know about. It's valid to have say uninstalled an app. --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 298c90527..adc94cf02 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -673,12 +673,16 @@ AppWell.prototype = { this._redisplay(); }, - _lookupApp: function(id) { - let app = this._appSystem.lookup_app(id); - if (!app) { - log("failed to look up app " + id); - }; - return app; + _lookupApps: function(appIds) { + let result = []; + for (let i = 0; i < appIds.length; i++) { + let id = appIds[i]; + let app = this._appSystem.lookup_app(id); + if (!app) + continue; + result.push(app); + } + return result; }, _redisplay: function() { @@ -693,8 +697,8 @@ AppWell.prototype = { let runningIds = this._appMonitor.get_running_app_ids().filter(function (e) { return !(e in favoriteIdsObject); }); - let favorites = favoriteIds.map(Lang.bind(this, this._lookupApp)); - let running = runningIds.map(Lang.bind(this, this._lookupApp)); + let favorites = this._lookupApps(favoriteIds); + let running = this._lookupApps(runningIds); this._favoritesArea.redisplay(favorites); this._runningArea.redisplay(running); // If it's empty, we hide it so the top border doesn't show up